Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): Do not user util.types.isProxy for tracking of augmented objects #5836

Merged
merged 3 commits into from
Mar 30, 2023

Conversation

OlegIvaniv
Copy link
Contributor

This PR updates the augment function in utils.ts to use a WeakSet to track objects that have already been augmented. This prevents infinite recursion in cases where an object contains circular references.
Previously, the augment function used the isProxy function from the util module to check if an object had already been augmented. However, this caused issues when running in browser environment where the util module was not available.

Github issue / Community forum post (link here to close automatically): #5769

@github-actions
Copy link
Contributor

Great PR! Please pay attention to the following items before merging:

Files matching packages/**:

  • If fixing bug, added test to cover scenario.
  • If addressing forum or Github issue, added link to description.

Files matching packages/**/*.ts:

  • Added unit tests to cover new or updated functionality.

Make sure to check off this list before asking for review.

)
return value;

// Track augmented objects to prevent infinite recursion in cases where an object contains circular references
augmentedObjects.add(value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will hold on references to these objects forever, and lead to a memory-leak.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind. I forgot that WeakSet would not block the GC.

@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (6f72091) 14.83% compared to head (d2e330a) 14.84%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5836   +/-   ##
=======================================
  Coverage   14.83%   14.84%           
=======================================
  Files        2475     2475           
  Lines      113367   113368    +1     
  Branches    17702    17703    +1     
=======================================
+ Hits        16823    16824    +1     
  Misses      95999    95999           
  Partials      545      545           
Impacted Files Coverage Δ
packages/workflow/src/AugmentObject.ts 94.80% <100.00%> (+0.06%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@OlegIvaniv OlegIvaniv merged commit aacbb54 into master Mar 30, 2023
@OlegIvaniv OlegIvaniv deleted the ado-499-variable-selector-empty-when-following-a branch March 30, 2023 11:29
@n8n-assistant n8n-assistant bot added the Upcoming Release Will be part of the upcoming release label Mar 30, 2023
netroy pushed a commit that referenced this pull request Mar 30, 2023
believe-Mahesh pushed a commit to believe-Mahesh/n8n that referenced this pull request Apr 4, 2023
@janober
Copy link
Member

janober commented Apr 19, 2023

Got released with n8n@0.223.0

sunilrr pushed a commit to fl-g6/qp-n8n that referenced this pull request Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released skip-e2e Upcoming Release Will be part of the upcoming release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants